package cn.iocoder.yudao.module.shop.dal.mysql.staff;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.staff.StaffDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.staff.vo.*;

/**
 * 店铺员工 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface StaffMapper extends BaseMapperX<StaffDO> {

    default PageResult<StaffDO> selectPage(StaffPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StaffDO>()
                .eqIfPresent(StaffDO::getShopId, reqVO.getShopId())
                .eqIfPresent(StaffDO::getShopIdentityId, reqVO.getShopIdentityId())
                .eqIfPresent(StaffDO::getTitle, reqVO.getTitle())
                .likeIfPresent(StaffDO::getName, reqVO.getName())
                .eqIfPresent(StaffDO::getAvatarImg, reqVO.getAvatarImg())
                .eqIfPresent(StaffDO::getSalary, reqVO.getSalary())
                .eqIfPresent(StaffDO::getService, reqVO.getService())
                .orderByDesc(StaffDO::getId));
    }

}